/**
 * 
 */
package metalink.admin;

import java.util.ArrayList;

import model.admin.GetStaffListMo;
import model.admin.StaffFinancialsMo;

import vo.CollegeStaffVo;
import vo.StaffFinancialsVo;
import vo.mixed.CollegeStaffFinancialsVo;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author Sony
 * 
 */
public class GetFinancials extends ActionSupport {
	ArrayList<CollegeStaffVo> list = new ArrayList<CollegeStaffVo>();
	ArrayList<CollegeStaffFinancialsVo> financelist = new ArrayList<CollegeStaffFinancialsVo>();
	String type = "",edit="";
	int salary_amount;
	String salary_date;
	int payment_made;
	int year;
	int month;
	int acc_no;
	String roll_number;
	String transaction_id;
	int staff_id;
	int college_staff_financial_id;

	public String execute() {
		// CollegeStaffFinancialsVo vo=new CollegeStaffFinancialsVo();
		System.out.println("edit="+edit+" id="+staff_id);
		if (type.equals("staff")) {
			System.out.println("in if : edit="+edit+" id="+staff_id);
			if(edit.equals(""))
			{
			GetStaffListMo mo = new GetStaffListMo();
			list = mo.getStaffList();
			return SUCCESS;
			}
			else if(edit.equals("addnewentry"))
			{
				System.out.println("add new entry...!!");
				GetStaffListMo mo = new GetStaffListMo();
				list=mo.getStaffDetails(staff_id);
				return "addnewentry";
			}
			else if(edit.equals("editentry"))
			{
				System.out.println("edit entry...!!");
				StaffFinancialsMo mo=new StaffFinancialsMo();
				financelist=mo.getEntryDetails(college_staff_financial_id);
				return "editentry";
			}
			else if(edit.equals("editedentry"))
			{
				StaffFinancialsVo vo=new StaffFinancialsVo();
				vo.setMonth(month);
				vo.setPayment_made(payment_made);
				vo.setSalary_amount(salary_amount);
				vo.setStaff_id(staff_id);
				vo.setTransaction_id(transaction_id);
				vo.setYear(year);
				vo.setCollege_staff_financial_id(college_staff_financial_id);
				vo.setAcc_no(acc_no);
				StaffFinancialsMo mo=new StaffFinancialsMo();
				mo.editEntry(vo);
				return "editedentry";
			}
			else if(edit.equals("viewall"))
			{
				System.out.println("view all...!!");
				StaffFinancialsMo mo=new StaffFinancialsMo();
				financelist=mo.getFinancialHistory(staff_id);
				return "viewall";
			}
			else if(edit.equals("delentry"))
			{
				StaffFinancialsMo mo=new StaffFinancialsMo();
				mo.deleteEntry(college_staff_financial_id);
				return "edited";
			}
			else if(edit.equals("add"))
			{
				StaffFinancialsVo vo=new StaffFinancialsVo();
				vo.setMonth(month);
				vo.setPayment_made(payment_made);
				vo.setSalary_amount(salary_amount);
				vo.setStaff_id(staff_id);
				vo.setTransaction_id(transaction_id);
				vo.setYear(year);
				vo.setAcc_no(acc_no);
				StaffFinancialsMo mo=new StaffFinancialsMo();
				mo.addEntry(vo);
				return "added";
			}
		}
		return SUCCESS;
	}

	public int getCollege_staff_financial_id() {
		return college_staff_financial_id;
	}

	public void setCollege_staff_financial_id(int college_staff_financial_id) {
		this.college_staff_financial_id = college_staff_financial_id;
	}

	public int getStaff_id() {
		return staff_id;
	}

	public void setStaff_id(int staff_id) {
		this.staff_id = staff_id;
	}

	public String getEdit() {
		return edit;
	}

	public void setEdit(String edit) {
		this.edit = edit;
	}

	public ArrayList<CollegeStaffVo> getList() {
		return list;
	}

	public void setList(ArrayList<CollegeStaffVo> list) {
		this.list = list;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public ArrayList<CollegeStaffFinancialsVo> getFinancelist() {
		return financelist;
	}

	public void setFinancelist(ArrayList<CollegeStaffFinancialsVo> financelist) {
		this.financelist = financelist;
	}

	public int getSalary_amount() {
		return salary_amount;
	}

	public void setSalary_amount(int salary_amount) {
		this.salary_amount = salary_amount;
	}

	public String getSalary_date() {
		return salary_date;
	}

	public void setSalary_date(String salary_date) {
		this.salary_date = salary_date;
	}

	public int getPayment_made() {
		return payment_made;
	}

	public void setPayment_made(int payment_made) {
		this.payment_made = payment_made;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public int getMonth() {
		return month;
	}

	public void setMonth(int month) {
		this.month = month;
	}

	public int getAcc_no() {
		return acc_no;
	}

	public void setAcc_no(int acc_no) {
		this.acc_no = acc_no;
	}

	public String getRoll_number() {
		return roll_number;
	}

	public void setRoll_number(String roll_number) {
		this.roll_number = roll_number;
	}

	public String getTransaction_id() {
		return transaction_id;
	}

	public void setTransaction_id(String transaction_id) {
		this.transaction_id = transaction_id;
	}
}
